package com.ghy.text;

import com.ghy.entity.EbProductCategory;
import com.ghy.mapper.ProductCategoryMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:xml/spring-dao.xml")
public class ProductCategoryTest {
    @Autowired
    ProductCategoryMapper productCategoryMapper;

    @Test
    public void testSave(){
        EbProductCategory ebProductCategory = new EbProductCategory();
        ebProductCategory.setEpcId(567);
        ebProductCategory.setEpcName("女装");
        ebProductCategory.setEpcParentId(542);
        int num= productCategoryMapper.save(ebProductCategory);
        System.out.println(num);
    }
    @Test
    public void testSelect(){
        EbProductCategory one = productCategoryMapper.select(567);
        System.out.println(one);
    }
    @Test
    public void testProductDelete(){
        int result = productCategoryMapper.remove(668);
        System.out.println("result:"+result);
    }
    @Test
    public void testNewsUpdate() {
        EbProductCategory ebProductCategory = new EbProductCategory();
        ebProductCategory.setEpcId(567);
        ebProductCategory.setEpcName("女装");
        ebProductCategory.setEpcParentId(542);
        int result = productCategoryMapper.updateByPrimaryKey(ebProductCategory);
        System.out.println("result:"+result);
    }
    @Test
    public void testGetMaxPage(){
        Integer maxPage = productCategoryMapper.getMaxPage(4);
        System.out.println("maxPage="+maxPage);
    }
}